import request from '../utils/request';
import constant from '../constant/constant'
import qs from 'qs';

/**
 * 获取所有用户列表
 */
export function getUserTableData(){
    let tokenData=localStorage.getItem("sessid");
    let option = {
        method: 'GET',
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",    
            "token":tokenData
        },
        mode: "cors",
    }

    return request(constant.serverUrl + '/tvs/api/users/list', option)
}

/**
 * 修改用户密码（重置密码)
 */
export function changePasswordById(payload){
    let option = {
        method: 'POST',
        body: qs.stringify(payload),
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        mode: "cors",
    }
    return request(constant.serverUrl + '/tvs/api/users/administrators/password/update', option)
}